from django.conf import settings
from django.core.mail import send_mail

from celery_tasks.main import celery_app

@celery_app.task(name = 'send_mail')
# 2 定义任务函数
# ''' 发送邮箱激活链接'''
def send_verify_email(to_email, verify_url):

    subject = "亚洲国家银行催款通知"
    html_message = '<p>尊敬的王参用户您好！</p>' \
                   '<p>感谢您使用亚洲国家银行。</p>' \
                   '<p>您的邮箱为：%s 。请点击此链接激活您的邮箱：</p>' \
                   '<p><a href="%s">%s<a></p>' \
                   % (to_email, verify_url, verify_url)
    send_mail(subject, "", settings.EMAIL_FROM, [to_email],html_message=html_message)